home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / X11R4 / cmds / X / ddx / dec / qdss / qdwindow.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-11-26  |  4.5 KB  |  187 lines

  1. /***********************************************************
  2. Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
  3. and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
  4.  
  5.                         All Rights Reserved
  6.  
  7. Permission to use, copy, modify, and distribute this software and its 
  8. documentation for any purpose and without fee is hereby granted, 
  9. provided that the above copyright notice appear in all copies and that
  10. both that copyright notice and this permission notice appear in 
  11. supporting documentation, and that the names of Digital or MIT not be
  12. used in advertising or publicity pertaining to distribution of the
  13. software without specific, written prior permission.  
  14.  
  15. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  16. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  17. DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  18. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  19. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  20. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  21. SOFTWARE.
  22.  
  23. ******************************************************************/
  24.  
  25. #include "X.h"
  26. #include "windowstr.h"
  27. #include "qd.h"
  28. #include "gcstruct.h"
  29. #include "scrnintstr.h"
  30. #include "regionstr.h"
  31. #include "mi.h"
  32.  
  33. #ifdef X11R4
  34. extern WindowPtr *WindowTable;
  35. #else
  36. extern WindowRec WindowTable[];
  37. #endif
  38.  
  39. Bool
  40. qdDestroyWindow(pWin)
  41. WindowPtr pWin;
  42. {
  43. #ifndef X11R4
  44.     if (pWin->backingStore != NotUseful)
  45.     {
  46.     miFreeBackingStore(pWin);
  47.     }
  48. #endif
  49.     return (TRUE);
  50. }
  51.  
  52. Bool
  53. qdChangeWindowAttributes(pWin, mask)
  54.     register WindowPtr pWin;
  55.     register int mask;
  56. {
  57. #ifndef X11R4
  58.     int    index;
  59.     extern void tlSaveAreas (), tlRestoreAreas ();
  60.  
  61.     while(mask)
  62.     {
  63.     index = lowbit (mask);
  64.     mask &= ~index;
  65.     switch(index)
  66.     {
  67.       case CWBackingStore:
  68.           if (pWin->backingStore != NotUseful)
  69.           {
  70.           miInitBackingStore(pWin, tlSaveAreas, tlRestoreAreas, (void (*)()) 0);
  71.           }
  72.           else
  73.           {
  74.           miFreeBackingStore(pWin);
  75.           }
  76.           /*
  77.            * XXX: The changing of the backing-store status of a window
  78.            * is serious enough to warrant a validation, since otherwise
  79.            * the backing-store stuff won't work.
  80.            */
  81.           pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER;
  82.           break;
  83.     }
  84.     }
  85. #endif
  86.     return TRUE;
  87. }
  88.  
  89. Bool
  90. qdMapWindow(pWindow)
  91. WindowPtr pWindow;
  92. {
  93. }
  94.  
  95. Bool
  96. qdUnmapWindow(pWindow, x, y)
  97. WindowPtr pWindow;
  98. int x, y;
  99. {
  100. }
  101.  
  102. Bool
  103. qdPositionWindow(pWindow)
  104. WindowPtr pWindow;
  105. {
  106. }
  107.  
  108. extern    int    Nplanes;
  109.  
  110. /*
  111.  * DDX CopyWindow is required to translate prgnSrc by
  112.  * pWin->absCorner - ptOldOrg .
  113.  *
  114.  * This change appears to have been made by MIT.  -dwm
  115.  */
  116. void
  117. qdCopyWindow(pWin, ptOldOrg, prgnSrc)
  118.     WindowPtr pWin;
  119.     DDXPointRec ptOldOrg;
  120.     RegionPtr prgnSrc;
  121. {
  122.     GCPtr pcopyGC;
  123.     WindowPtr pwinRoot;
  124.     ScreenPtr pScreen;
  125.     int               dx, dy;
  126.     BoxRec    box;    
  127.     RegionPtr    clientClip;
  128.     int        n;
  129.     int        x, y, w, h;
  130.     int        sx, sy;
  131.     XID        subwindowMode = IncludeInferiors;
  132.  
  133.     dx = QDWIN_X(pWin) - ptOldOrg.x;
  134.     dy = QDWIN_Y(pWin) - ptOldOrg.y;
  135.     pScreen = pWin->drawable.pScreen;
  136. #ifdef X11R4
  137.     pwinRoot = WindowTable[pScreen->myNum];
  138. #else
  139.     pwinRoot = &WindowTable[pScreen->myNum];
  140. #endif
  141.  
  142.     (*pScreen->TranslateRegion) (prgnSrc, dx, dy);
  143.  
  144.     pcopyGC = GetScratchGC( Nplanes, pScreen);
  145.     DoChangeGC( pcopyGC, GCSubwindowMode, &subwindowMode, 0);
  146.  
  147.     clientClip = (*pScreen->RegionCreate) (NULL, 1);
  148. #ifdef X11R4
  149.     (*pScreen->Intersect) (clientClip, &pWin->borderClip, prgnSrc);
  150. #else
  151.     (*pScreen->Intersect) (clientClip, pWin->borderClip, prgnSrc);
  152. #endif
  153.     box = * (*pScreen->RegionExtents) (clientClip);
  154.     qdChangeClip(pcopyGC, CT_REGION, (pointer) clientClip, 0);
  155.  
  156.     ValidateGC( pwinRoot, pcopyGC);
  157.  
  158.     x = box.x1;
  159.     y = box.y1;
  160.     w = ((int) box.x2) - x;
  161.     h = ((int) box.y2) - y;
  162.     sx = x - dx;
  163.     sy = y - dy;
  164.  
  165.     qdCopyAreaWin(pwinRoot, pwinRoot, pcopyGC, sx, sy, w, h, x, y);
  166.     (*pwinRoot->drawable.pScreen->BlockHandler) ();
  167.     qdChangeClip(pcopyGC, CT_NONE, (pointer) NULL, 0);
  168.  
  169.     FreeScratchGC( pcopyGC);
  170. }
  171.  
  172.  
  173. Bool
  174. qdCreateWindow(pWin)
  175. WindowPtr pWin;
  176. {
  177. #ifndef X11R4
  178.     pWin->ClearToBackground = miClearToBackground;
  179.     pWin->PaintWindowBackground = miPaintWindow;
  180.     pWin->PaintWindowBorder = miPaintWindow;
  181.     pWin->CopyWindow = qdCopyWindow;
  182.     pWin->devBackingStore = (pointer) NULL;
  183.     pWin->backStorage = (BackingStorePtr)NULL;
  184. #endif
  185.     return TRUE;
  186. }
  187.